import { request } from "@/utils/request";


/**
 * 账号密码登陆
 * @param data
 * @returns
 */
const loginPwd = async (data: any) => {
	return request.post({
		url: '/login/username',
		data
	});
}

/**
 * 退出登录
 */
const logout = async () => {
	return request.get({ url: '/login/logout' });
}

/**
 * 清除缓存
 */
const clearCache = async () => {
	return request.get({ url: '/currentUser/clearCache' });
}

/**
 * 当前登录人信息
 */
const currentUser = async () => {
	return request.get({ url: '/currentUser/info' });
}

/**
 * 当前登录人角色和权限
 */
const getPermsApi = async () => {
	return request.get({ url: '/currentUser/getPerms' });
}

/**
 * 修改当前登录人信息
 */
const updateUser = async (data: any) => {
	return request.post({ url: '/currentUser/updateUser', method: 'POST', data });
}

export {
	loginPwd,
    currentUser,
    getPermsApi,
    clearCache,
    updateUser,
	logout
}
